#ifndef PCAPETHNET_H
#define PCAPETHNET_H

#include "pcappacket.h"

class CPCapEthFrame : public CPCapPacket
{
    Q_OBJECT
    Q_PROPERTY(QString destMac READ destMac WRITE setDestMac NOTIFY destMacChanged)
    Q_PROPERTY(QString sourceMac READ sourceMac WRITE setSourceMac NOTIFY sourceMacChanged)
    Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
public:
    explicit CPCapEthFrame(QObject *parent = Q_NULLPTR);
    ~CPCapEthFrame();

    QString destMac() const;
    void setDestMac(const QString &destMac);

    QString sourceMac() const;
    void setSourceMac(const QString &sourceMac);

    QString type() const;
    void setType(const QString &type);

    int headerLength() Q_DECL_OVERRIDE;
    bool buildHeader(QByteArray &header) Q_DECL_OVERRIDE;

Q_SIGNALS:
    void destMacChanged();
    void sourceMacChanged();
    void typeChanged();

private:
    QString m_destMac;
    QString m_sourceMac;
    QString m_type;
};

class CPCapEthLLCFrame : public CPCapEthFrame
{
    Q_OBJECT
    Q_PROPERTY(QString dsap READ dsap WRITE setDSAP NOTIFY dsapChanged)
    Q_PROPERTY(QString ssap READ ssap WRITE setSSAP NOTIFY ssapChanged)
public:
    QString dsap() const;
    void setDSAP(const QString &dsap);

    QString ssap() const;
    void setSSAP(const QString &ssap);

    int headerLength() Q_DECL_OVERRIDE;
    bool buildHeader(QByteArray &header) Q_DECL_OVERRIDE;

Q_SIGNALS:
    void dsapChanged();
    void ssapChanged();

private:
    QString m_dsap;
    QString m_ssap;
    QString m_ctrl;
};

class CPCapEthSNAPFrame : public CPCapEthLLCFrame
{
    Q_OBJECT
    Q_PROPERTY(QString snap READ snap WRITE setSNAP NOTIFY snapChanged)
public:
    QString snap() const;
    void setSNAP(const QString &snap);

    int headerLength() Q_DECL_OVERRIDE;
    bool buildHeader(QByteArray &header) Q_DECL_OVERRIDE;

Q_SIGNALS:
    void snapChanged();

private:
    QString m_snap;
};

#endif // PCAPETHNET_H
